﻿using System;
using ZFine.Application.Gas;
using ZFine.Code;
using ZFine.Domain.Entity.Gas;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;

namespace ZFine.Web.Areas.Gas.Controllers
{
    public class CameraController : ControllerBase
    {
        private CameraApp cameraApp = new CameraApp();
        [HandlerAuthorize(ignore: false)]
        public override ActionResult Details()
        {
            return View();
        }
        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetGridJson(Pagination pagination, ResidentEntity in_resident)
        {
            List<CameraEntity> l_camera = cameraApp.GetList(pagination);
            //因为有部分车牌没有记录，需要使用左连接
            var rows = l_camera;
            var data = new
            {
                page = pagination.page,//当前页  1  2 3 之类
                records = pagination.records,//总条数  这里应该是18
                rows = rows,//分页的数据
                total = pagination.total,//页数
            };
            return Content(data.ToJson());
        }
        [HttpGet]
        [HandlerAjaxOnly]
        public ActionResult GetFormJson(string keyValue)
        {
            CameraEntity data = cameraApp.GetForm(keyValue);
            return Content(data.ToJson());
        }
    }
}
